<template>
  <div class="">
    <el-button type="primary" @click="submit">保存</el-button>
    <el-input type="textarea" v-model="text" placeholder="" rows="30"></el-input>
  </div>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { saveBatch } from '@/api/index'

const text = ref()
function submit() {
  try {
    let evalList = eval(text.value);
    let list = evalList.map((item: any) => {
      return {
        id: item.id,
        parentId: item.parentId,
        name: item.name,
        metaTitle: item.meta.title,
        metaIcon: item.meta.icon,
        metaShow: item.meta.show,
        component: item.component,
        path: item.path,
        redirect: item.redirect
      }
    })
    saveBatch(list)
  } catch (error) {
    console.log('格式问题')
  }
}
</script>
<style></style>
